export default {
    data () {
      return {
        treeHeight: 0,
        // tableHeight:0,
        isCollapse: true
      }
    },
    watch: {
      isCollapse () {
        this.treeHeightData()
        // this.tableHeightData();
      }
    },
    mounted () {
      this.treeHeightData()
      // this.tableHeightData();
      window.addEventListener('resize', () => { this.treeHeightData() })
      // window.addEventListener('resize', () => { this.tableHeightData() })
    },
    beforeDestroy () {
      window.removeEventListener('resize', () => { this.treeHeightData() })
      // window.removeEventListener('resize', () => { this.tableHeightData() })
    },
    methods: {
      treeHeightData(isCollapsed) {
        this.$nextTick(
          () => {
            let h = document.documentElement.clientHeight
            h=h-180
            if (this.$refs.hMain) { // 页面上如果有面包屑区域徐减去它的高度
              if (this.$refs.hMain.$el) {
                h = h - this.$refs.hMain.$el.offsetHeight
              }
            }
            this.treeHeight = h > 310 ? h : 310 // 根据自己项目定高度
            return h
          }
        )
      },

      // tableHeightData (isCollapsed) {
      //   this.$nextTick(
      //     () => {
      //       let h = document.documentElement.clientHeight

      //       console.log(this.$refs.queryForm.offsetHeight,"sdklfjklliuhaiorng")
      //       h=h-220
      //       if (this.$refs.queryForm) { // 页面上如果有面包屑区域徐减去它的高度
      //         h = h - this.$refs.queryForm.$el.offsetHeight
      //       }

      //        if (this.$refs.refbut) { // 页面上如果有分页区域徐减去它的高度
      //         h = h - this.$refs.refbut.$el.offsetHeight
      //       }
      //       // console.log(h,"sdjfdklsjfkl")
      //       this.tableHeight = h > 310 ? h : 310 // 根据自己项目定高度
      //       return h
      //     }
      //   )
      // }

    }
  }

